package org.linphone.activity;

import com.leehuubsd.yiyanzb.R;
import com.umeng.analytics.MobclickAgent;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class AboutActivity extends Activity implements OnClickListener {
	private TextView tv, text, tv7;
	private ImageView iv;
	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}

	public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_about_layout);
		tv = (TextView) findViewById(R.id.about_tv2);
		text = (TextView) findViewById(R.id.text5);
		tv7 = (TextView) findViewById(R.id.text7);
		tv.setText("V" + getVersion());
		iv = (ImageView) findViewById(R.id.back_btn_about);
		iv.setOnClickListener(this);
		text.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);// 下划线
		tv7.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);// 下划线
		text.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Uri uri = Uri.parse("tel:15084824397");
				Intent it = new Intent(Intent.ACTION_DIAL, uri);
				startActivity(it);
			}
		});
		tv7.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setData(Uri.parse("http://www.0991hzyj.com"));
				intent.setAction(Intent.ACTION_VIEW);
				startActivity(intent);
			}
		});

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.back_btn_about:
			finish();
			break;

		default:
			break;
		}

	}

	private String getVersion() {
		try {
			// 得到包管理器
			PackageManager pm = getPackageManager();
			PackageInfo packageInfo = pm.getPackageInfo(getPackageName(), 0);
			// 返回版本名
			String str = packageInfo.versionName.substring(0, 5);
			return str;
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}

	}

}
